//
//  ByDoctorMyVC.m
//  jinpuyiyuan_ios
//
//  Created by mc on 2017/12/4.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByDoctorMyVC.h"

// view
#import "ByViewDoctorMyHeader.h"

@interface ByDoctorMyVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) ByViewDoctorMyHeader *headerView;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, copy)   NSArray *titles;
@property (nonatomic, copy)   NSArray *images;
@end

@implementation ByDoctorMyVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的";
    [self addBYItemviews:@[@"My_shezhi"] mode:ByNavigationItemModeImage position:ByNavigationItemPositionModeRight];
    [self createViews];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setNaviAttributeWithTranslucent:YES stateBarLightContent:YES];
    ByModelUser *model = [[ByModelUser alloc] init];
    self.headerView.model = model;
}

- (void)rightItemsAction:(NSInteger)rightIndex{
//    ByUserMySetVC *vc = [[ByUserMySetVC alloc] init];
//    [self by_normalPush:vc hasNavi:YES];
}
#pragma mark - getter
- (NSArray *)titles{
    if (!_titles) {
        _titles = @[@[@"更改工作状态"],
                    @[@"意见反馈",@"联系我们"]];
    }
    return _titles;
}

- (NSArray *)images{
    if (!_images) {
        _images = @[@[@"My_jiuzhen"],
                    @[@"My_chufang",@"My_huayan",@"My_zhuyuan"],
                    @[@"My_ideas",@"My_contact"]];
    }
    return _images;
}
#pragma mark - create views
- (void)createViews{
    self.headerView = [[ByViewDoctorMyHeader alloc] init];
    [self.view addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(0));
        make.left.equalTo(@(0));
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 300));
    }];
    
    self.tableView = [[UITableView alloc] init];
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(0));
        make.right.equalTo(@(0));
        make.top.equalTo(self.headerView.mas_bottom);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-49);
    }];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = BY_TABLE_COLOR;
    self.tableView.separatorColor = [UIColor colorWithWhite:0.90 alpha:1];
    self.tableView.separatorInset = UIEdgeInsetsMake(49, 10, 1, 10);
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.titles.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSArray *rowCount = self.titles[section];
    return rowCount.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *indentier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:indentier];
        cell.textLabel.font = FONT(14);
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.imageView.image = [UIImage imageNamed:self.images[indexPath.section][indexPath.row]];
    cell.textLabel.text = self.titles[indexPath.section][indexPath.row];
    if (indexPath.section == 0) {
//        cell.detailTextLabel.text = @"实名制认证";
//        cell.detailTextLabel.font = FONT(14);
    }else{
//        cell.detailTextLabel.text = @"";
    }
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 5;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
@end
